Fred Sharples
www.orangedesign.com
Previous Columns
- ColdFusion MX for JRun 4 and Mac OS X
by Christian Cantrell - Macromedia Flash Detection Kit
by Fred Sharples - Simplicity Is Just The Start Of It
by Ben Forta - DRK 3 and Data Connection Kit
by Mike Chambers - ColdFusion MX and Databases
by Debbie Dickerson - Flashforward 2003
by Mike Chambers - Rich Internet Applications Come of Age
by Tom Hale - Dreamweaver MX: Supporting the PHP and ASP.NET Application Server Platforms
by George Fox - Now Announcing DevNet Subscriptions, Studio MX Plus, and FreeHand MX
by Ed Krimen - The Rich Media Advertising Development Center
by Suzanne Mattis - Macromedia Expands JRun and ColdFusion MX for J2EE to the Macintosh OS X Platform
by Christian Cantrell - Experience Matters
by Al Ramadan - Introducing Director MX
by Miriam Geller - Selling management on Rich Internet Applications
by Roger Murff - The end of hassles
by Eric Larsen - DevCon 2002 wrap-up
by Tom Hale - Experience: Can you bottle it?
by Michael Gough - The Macromedia anti-piracy program
by Steve Wozniak - Certification: Stand out from the crowd
by Tiffany Beltis - ColdFusion MX for J2EE
by Tom Hale - Introducing the Macromedia Developer Resource Kit
by Mike Chambers - Securing your web applications
by Vernon Viehe - The Answers Panel: Your lifeline to Macromedia
by Ana Dujmovic - DevCon 2002: Architecting a new Internet experience
by Greg Stern - Tips Library: Finding the "better way"
by Mimi Rosenheim - Which edition of Macromedia Flash Communication Server MX do I need?
by Mike Chambers - The future of Macromedia Flash on Devices
by Mike Chambers - Introducing Pet Market
by Steve Petersen - Get in touch with us
by Craig Goodman - Blogs are huge
by Ed Krimen - Macromedia MX, the future is already here
by Tom Hale - What's up in the Macromedia Flash MX world?
by Mike Chambers - What server language should I use?
by Matt Brown - Macromedia Flash MX favorite feature
by Mike Chambers - Macromedia Flash MX: New product, more power
by Tom Hale - Why you should care about XML
by Mike Chambers - Rapid development with extensions
by Matt Brown
New Macromedia Flash Detection Kit
Note: Macromedia Flash Detection Kit is now available—and it’s free.
What happens when a user encounters your Macromedia Flash content with an old or outdated version of Macromedia Flash? What does a user see in an older web browser that doesn’t support plug-in detection? Do you know what will happen if users visit your site with Internet Explorer Macintosh version 4.5? Have you ever had a client call you up in a panic when he can’t see the content you just spent two months developing together?
Macromedia Flash Detection Kit lets you control user experience through version detection. It handles nearly every case you can imagine, and it’s very easy to use.
Macromedia Flash Detection Kit contains a detection behavior you can use in Dreamweaver. It also includes example files that we've customized for various types of code: ActionScript, HTML, and for Standalone Macromedia Flash Player (for content hosted on mobile devices, such as the Nokia 9200 series PDA/phone.
For most users, the most important element of Macromedia Flash Detection Kit is the Dreamweaver behavior. While you can apply the features of the kit yourself using source code in the example files, the detection behavior is the easiest approach.
Requirements
To use Macromedia Flash Detection Kit, you need the following software:
Macromedia Flash Detection Kit (free)
Macromedia Flash MX
Dreamweaver MX (Optional)
Macromedia Flash Detection Behavior for Dreamweaver
When using Macromedia Flash Detection Behavior for Dreamweaver, you normally apply it to a web page that appears before any Macromedia Flash content displays on your site. Usually this is the index.html page or the default.html page. The detection behavior will evaluate the user's configuration and redirect the user's browser to a page appropriate for his or her setup. (See Figure 1.)
Figure 1. Macromedia Flash Detection Behavior for Dreamweaver settings.
The behavior settings include:
- Macromedia Flash Content URL: This is the URL of the web page that contains your Macromedia Flash content.
- Alternate Non-Flash URL: The behavior will point to this page when the user doesn't have the required version of Macromedia Flash. You can provide either an alternate content or an upgrade page.
- Macromedia Flash Player Requirements:
- Version: This is the version of Macromedia Flash Player you website or page requires to play your Macromedia Flash content located in the field specified in Macromedia Flash Content URL.
- Major Revision: Major Revision refers to the second part or "dot" of the version so with Version 7.2 r11, Major Revision refers to the 2.
- Minor Revision: Minor Revision refers to the last part of the version. For example, if your website or page requires Version 7.2 r11, Minor Revision refers to the 11.
- Allow Auto-Update: This allows you to auto-update Macromedia Flash Player if a visitor uses Microsoft Internet Explorer on Microsoft Windows.
Under the Hood
Macromedia Flash Player is almost ubiquitous; approximately 90% of users can view Macromedia Flash content created in Macromedia Flash 4. For more details, read the Macromedia Flash Player Version Penetration Study. This frees developers from depending on several old JavaScript and VBScript methods that did not work properly across different browsers. Developers can now use Macromedia Flash to detect Macromedia Flash and insert a meta refresh tag to catch all the visitors who do not have at least Macromedia Flash 4.0411 installed.
Using Macromedia Flash to detect Macromedia Flash? Here’s how it works:
- The Macromedia Flash Detection Behavior inserts a Macromedia Flash SWF into the body tag of the HTML file you define in the Macromedia Flash Content URL setting in the behavior interface. This SWF is a Macromedia Flash 4 file—all of its ActionScript code consists of Macromedia Flash 4 style.
- The HTML code that the behavior inserts into the file also passes required variables to the SWF using object and embed tags and the new Macromedia Flash vars property.
ActionScript within the SWF compares the version and revision numbers that your website requires to those found in the Macromedia Flash 4-style $version string. Note: Macromedia Flash version 4.0r11 introduced the $version string. Macromedia Flash 5 replaced it with the
getVersion()function. You can see how to access $version by entering the following code into your own Macromedia Flash Movie.trace(eval("$version"))- If the SWF cannot find the $version string, or if it can’t receive variables at all, it knows that the visitor’s player is at least older than version 4.0r11. When a user does not have Macromedia Flash installed or has a pre-Flash 4r11 version of Macromedia Flash, the SWF will not be able to redirect the user to your specified URL.
When you use the Dreamweaver behavior, it writes a meta tag redirect called a meta refresh into the <head> tag of the HTML file. If the SWF cannot redirect the user to your specified URL, the meta refresh sends the visitor a page they can view. The Dreamweaver behavior sets the URL in this tag to the same file as the Non-Flash URL you specified in the altContentURL setting in the Behavior. For instance:
<META HTTP-EQUIV="refresh" content="3;URL=upgrade_flash/upgrade_flash.html">
This ensures that as long as a browser supports meta refresh, you can direct users who are using old Macromedia Flash Player versions to a page to let them look at alternate content.
If all of this sounds easy, that’s because it is. It’s easy enough that you can write and customize the detection routines yourself using the example files included in Macromedia Flash Detection Kit.
Tips for Using the Example Files in Macromedia Flash Detection Kit
Once you’ve downloaded and extracted the Macromedia Flash Detection Kit ZIP or HQX file, you can take a look at the example files. Developers who want to customize the user experience can use these files to tweak the detection settings to produce the results they need.
Find the example files in the folder called Examples. Inside this folder you will find example files for ActionScript developers and HTML coders, and an example file for authors of the Standalone Macromedia Flash Player such as the player for the Nokia 9200 series phone/PDA.
Here are a few reasons why you might want to use the example files from Macromedia
Flash Detection Kit and some short explanations of how to use them:
- You don’t want to use a meta refresh tag. If you’re
an ActionScript developer and don’t want to use meta refresh tags,
you can easily edit the ActionScript code in the flash_detection_as.fla
example file to do the same thing. Just go to the last line of the
code (shown below) in the frame script for Frame 1 of flash_detection_as.fla
and change the address in the getURL action.
//:TRICKY:This must be the last operation in the detection scheme so do not move it up in the sequence flash3test = 1; if (flash3test<>1) { //This getURL will be called only in Flash versions < 4.0. Please edit the URL as you wish. //Because of backward compatibility requirement, this address cannot be set with a variable. getURL("upgrade_flash/upgrade_flash.html", "_self"); } You want to support the latest version or out of sync versions. If you want the user to have the latest version (as of May 2003) of two players such as 6,0,79 on Windows and 6,0,80 on PocketPC, do the following:
Set the
requireLatestVersionvalue to true, as follows:requireLatestVersion = true;
You can find this setting in the ActionScript contained in the frame script in Frame 1 of flash_detection_as.fla.
If you want users to automatically download and install these latest versions, use the Allow Auto-Update feature. To do this, set
allowFlashAutoInstall=truein the embed tag.Note: You cannot set this in ActionScript; you must set it in the HTML. Also, you must set the
allowFlashAutoInstallvariable in theobjecttag, not in theembedtag. Only Internet Explorer for Windows uses the Object Tag; nearly all other browsers use the Embed tag. Therefore, this functionality only applies to Internet Explorer.If you’re hand-coding HTML, you may want to set your variables using both object and embed tags as well as Macromedia Flash Vars. This ensures that the variables are passed along to all versions of Macromedia Flash Player that support variables. This is a workaround for an issue in Macromedia Flash Player 6.0r47 with passing variables through the
objectandembedtags. See Using FlashVars to pass variables to a SWF (TechNote 16417).
You want to support Standalone Macromedia Flash Player. The standalone player does not use a browser, so you can use the standalone player example to detect the Macromedia Flash version for players on devices such as the Nokia 9200 series phone/PDA. The following commented ActionScript code is in the first frame of the movie and contains three variables that reflect the required version to view your content:
//The required player version necessary to view the content. contentVersion = 5; //The 'dot' release of the player necessary to view the content. contentMajorRevision = 0; //The revision number of the player necessary to view the content. contentMinorRevision = 90;
For more information on using the example files, see the documentation and source code comments in Macromedia Flash Detection Kit.
What’s New Other Than the Name?
If you used the previous version of the Macromedia Flash Detection Kit, which was previously know as the Macromedia Flash Deployment Kit, you might see a lot of similarities. However, this time Macromedia rewrote the entire kit from scratch. Here are some of the most important improvements:
- Easier to use: There is now more documentation. There is less code, and we simplified the interface to the Dreamweaver Behavior.
- Smaller: Using the previous Macromedia Flash Deployment kit required the end user to download up to 19k in JavaScript, VBScript, and in some cases, a Macromedia Flash SWF. The new Macromedia Flash Detection Kit only requires end users to download files that total less than 3K in size.
- More robust: Because it does not use JavaScript and VBScript, the new Macromedia Flash Detection Kit is supported by far more browsers. It now supports detection of major and minor revision numbers. It also supports Standalone Macromedia Flash Player.
Get Started
If you just want to get started and work with the kit, I suggest you start by checking out the Macromedia Flash Detection Behavior for Dreamweaver. I use it in my projects because it’s so easy; I don’t have to code at all. On top of that, you can download it for free.
About the author
Fred Sharples is the founder and Creative Director of Orange Design, an interactive creativity company that specializes in Macromedia Flash application and game development. Fred has been a frequent speaker and Film Festival Judge at Flash Forward New York and San Francisco. Fred was a contributing author for the best selling Flash book; Flash Web Design—The Art of Motion Graphics by Hillman Curtis. Fred is also a contributing author in the book, Flash Enabled: Flash Design and Development for Devices.
Submit feedback on our tutorials, articles, and sample applications.